# Contributor: alpine-mips-patches <info@mobile-stream.com>
# Maintainer: alpine-mips-patches <info@mobile-stream.com>
pkgname=coq
pkgver=8.8.2
pkgrel=0
pkgdesc="A formal proof management system"
url="https://coq.inria.fr"
arch="aarch64 ppc64le x86_64"  # reflect ocaml aport platforms
license="LGPL-2.1"
depends="ocaml-runtime"
makedepends="ocaml ocaml-compiler-libs ocaml-findlib ocaml-camlp5-dev ocaml-num-dev"
options="!check"
subpackages="$pkgname-doc $pkgname-emacs:emacs:noarch"
source="$pkgname-$pkgver.tar.gz::https://github.com/coq/$pkgname/archive/V$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	./configure \
		-prefix /usr \
		-coqdocdir /usr/share/texmf-dist/tex/latex/misc \
		-bytecode-compiler no \
		-coqide no \
		-nodebug
	make world
}

package() {
	cd "$builddir"
	make OLDROOT= COQINSTALLPREFIX="$pkgdir" install
}

emacs() {
	depends="$pkgname=$pkgver-r$pkgrel emacs"
	pkgdesc="$pkgdesc (Emacs files)"

	mkdir -p "$subpkgdir/usr/share"
	mv "$pkgdir/usr/share/emacs" "$subpkgdir/usr/share"
}

sha512sums="b0f0480fe052fced6016014cf1872d4e004b0dacb779927376d797c279aca9d5f6f4ed3d0f5ee5d42748bbd5c29b43f7a69748564a12a116bcc7ba3b052d8954  coq-8.8.2.tar.gz"
